<?php
/** Copyright 2014 TinPhp Systems, Inc.
 * @author zhangxilian 2013-8-15
 */
if (!defined('IN_TINPHP')) {
    exit('Access Denied');
}

require_once('indexApp.php');

class IndexController extends IndexAppController {
	
	public function __construct() {
        parent::__construct();
	}
 	
 	public function actionDefault(){			
        
        $artLogic = new ArticleLogic();
        $newlist = $artLogic->getArtList("*", "CATID=1", "order by id desc", 1, 7);
        T::$tpl->set('newlist', $newlist);
        
        $helplist = $artLogic->getArtList("*", "CATID=7", "order by id desc", 1, 7);
        T::$tpl->set('helplist', $helplist);
        
        $asklist = $artLogic->getArtList("*", "CATID=15 and state = 1", "order by id desc", 1, 7);
        T::$tpl->set('asklist', $asklist);
        
        $DealLogic =new DealLogic();
        $cond="STATE = 1 AND DEAL_STAT IN (2,3,4,5,6)";
        $res = $DealLogic->getDealList("*", $cond, "order by id desc", 1, 5);
            if($res['data']){
                foreach($res['data'] as $k=> $v){
                    $res['data'][$k]['stime'] = strtotime($v['BAD_TIME']) - time();      //倒计时
                    $res['data'][$k]['loading'] = round(($v['PRICE_LOAD'] / $v['PRICE_ALLOW'])*100);  //进度
                }
            }
        T::$tpl->set('loanlist', $res['data']);
        
        T::$tpl->set('user',$this->user);
 	}
         public function actionCalculator(){
             T::$tplFile='public/calculator';
         }
 	
}//End CLass
?>
